import register from "../views/register.art";
import ajax from "../business/ajax.js";
import router from "../router/router.js";
function registerInit(res){
    res.render(register());
    $("#registerForm").on("submit",submitHandler);
}

function submitHandler(e){
    e.preventDefault();
    var form=new FormData(this);
    $(document).on("registerSuccess",successHandler);
    ajax("register",form);
}

function successHandler(e){
    router.go("/login")
}

export default registerInit;